package org.sluggard.tangela.sina;

import org.sluggard.tangela.core.AbstractToken;
import org.sluggard.tangela.core.Container;

import weibo4j.http.AccessToken;

public class SinaToken extends AbstractToken {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 7664520467211301136L;

	private AccessToken accessToken;
	
	private static final String NAME = "sina";
	
	@Override
	public void sendMessage(String content) {
		OAuth.update(accessToken, content);
	}

	public AccessToken getAccess() {
		return accessToken;
	}

	public void setAccess(AccessToken accessToken) {
		this.accessToken = accessToken;
	}

	public void setState(boolean state) {
		this.state = state;
	}

	private SinaToken() {
		super();
	}

	@Override
	public String getName() {
		return NAME;
	}
	
	public static SinaToken getInstence() {
		SinaToken st = (SinaToken) Container.getToken(NAME);
		if(st == null) st = new SinaToken();
		return st;
	}
}
